//
//  ViewController.swift
//  UI13-NeteasyNews
//
//  Created by yao_yu on 14-9-9.
//  Copyright (c) 2014年 yao_yu. All rights reserved.
//

import UIKit

class ViewController: UIViewController {
    
    var detailView: UIView?
                            
    override func viewDidLoad() {
        super.viewDidLoad()

        let rect = CGRectMake(0, 0, view.frame.size.width, view.frame.size.height)
        let imageLeft = UIImageView(image: UIImage(named: "left.png"))
        imageLeft.frame = rect
        view.addSubview(imageLeft)
        
        
        
    }
//    
//    [super viewDidLoad];
//    
//    CGRect rect = CGRectMake(0, 0,
//    self.view.frame.size.width,
//    self.view.frame.size.height);
//    
//    NSLog(@"w:%f, h:%f", rect.size.width, rect.size.height);
//    UIImageView *imageleft = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"left.png"]];
//    imageleft.frame = rect;
//    [self.view addSubview:imageleft];
//    
//    //添加详情页,设置到左侧不可见区域
//    UIImageView *imageDetailView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"detail.png"]];
//    imageDetailView.frame = rect;
//    detailView = [[DetailView alloc] initWithView:imageDetailView parentView:self.view];
//    detailView.center = CGPointMake(480, 230);
//    
//    [[detailView layer] setShadowOffset:CGSizeMake(10, 10)];
//    [[detailView layer] setShadowRadius:20];
//    [[detailView layer] setShadowOpacity:1];
//    [[detailView layer] setShadowColor:[UIColor blackColor].CGColor];
//    [self.view addSubview:detailView];
//    
//    
//    UIView *contentView = [[UIView alloc] initWithFrame:rect];
//    UIImageView *imageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"index.png"]];
//    imageView.frame = rect;
//    UIButton *goDetailPageBtn = [UIButton buttonWithType:UIButtonTypeCustom];
//    goDetailPageBtn.frame = CGRectMake(0, 230, 320, 70);
//    [goDetailPageBtn addTarget:self
//    action:@selector(goDetailPage:)
//    forControlEvents:UIControlEventTouchUpInside];
//    
//    [contentView addSubview:imageView];
//    [contentView addSubview:goDetailPageBtn];
//    
//    CustomView *customView = [[CustomView alloc] initWithView:contentView
//    parentView:self.view];
//    [[customView layer] setShadowOffset:CGSizeMake(10, 10)];
//    [[customView layer] setShadowRadius:20];
//    [[customView layer] setShadowOpacity:1];
//    [[customView layer] setShadowColor:[UIColor blackColor].CGColor];
//    
//    [self.view addSubview:customView];
    
    func goDetailPage(sender:AnyObject){
        view.exchangeSubviewAtIndex(1, withSubviewAtIndex: 2)

        
        UIView.animateWithDuration(0.5, animations: { () -> Void in
            let a = CGPointMake(160.0, 230.0)

            //
        })
           // detailView?.center = CGPointMake(160, 230)
            //}
    
    }


    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }


}

